﻿@using FikriKibar.Globalization
@using FikriKibar.UI.WebCommon.Helpers
@model FikriKibar.Entities.Composite.UserModels.UpdateModel
@{
    ViewBag.Title = Resources.Update;
    Layout = "~/Views/Shared/ContentLayout.cshtml";
}


<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">@Resources.UserManagement</h1>
        </div>
    </div>
    <div class="row">

        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    @Resources.Update
                </div>
                <div class="panel-body">
                    @using (Html.BeginForm("Update", "User", FormMethod.Post, new { @role = "form" }))
                    {

                        <div class="form-group">
                            <label class="control-label" for="User_Username">@Resources.Username</label>
                            @Html.FikriKibarTextBoxFor(m => m.User.Username, new { @class = "form-control", @maxlength = 32 })
                            @Html.ValidationMessageFor(m => m.User.Username)
                        </div>
                        <div class="form-group">
                            <label class="control-label" for="User_Password">@Resources.Password</label>
                            @Html.FikriKibarPasswordFor(m => m.User.Password, new { @class = "form-control", @maxlength = 32 })
                            @Html.ValidationMessageFor(m => m.User.Password)
                        </div>
                        <div class="form-group">
                            <label class="control-label" for="User_ConfirmPassword">@Resources.ConfirmPassword</label>
                            @Html.FikriKibarPasswordFor(m => m.User.ConfirmPassword, new { @class = "form-control", @maxlength = 32 })
                            @Html.ValidationMessageFor(m => m.User.ConfirmPassword)
                        </div>
                        <div class="form-group">
                            <label class="control-label" for="User_Email">@Resources.Email</label>
                            @Html.FikriKibarEmailFor(m => m.User.Email, new { @class = "form-control", @maxlength = 32 })
                            @Html.ValidationMessageFor(m => m.User.Email)
                        </div>
                        <div class="form-group">
                            <label class="control-label" for="User_FirstName">@Resources.FirstName</label>
                            @Html.FikriKibarTextBoxFor(m => m.User.FirstName, new { @class = "form-control", @maxlength = 32 })
                            @Html.ValidationMessageFor(m => m.User.FirstName)
                        </div>
                        <div class="form-group">
                            <label class="control-label" for="User_LastName">@Resources.LastName</label>
                            @Html.FikriKibarTextBoxFor(m => m.User.LastName, new { @class = "form-control", @maxlength = 32 })
                            @Html.ValidationMessageFor(m => m.User.LastName)
                        </div>
                        <div class="form-group">
                            <label class="control-label" for="SelectedLanguageCode">@Resources.Language</label>
                            @Html.FikriKibarDropDownListFor(m => m.SelectedLanguageCode, new SelectList(Model.LanguageList, "LanguageCode", "LanguageName", Model.SelectedLanguageCode), new { @class = "form-control" })

                        </div>

                        <div class="form-group">
                            <label class="control-label">@Resources.Groups</label>
                            @foreach (var userGroup in Model.UserGroups)
                            {
                                <div>
                                    @Html.FikriKibarCheckBox("usergroup-" + userGroup.Id, true, new { @checked = "checked", @class = "" }) @userGroup.Id
                                </div>
                            }
                        </div>


                        <div class="form-group">
                            <label class="control-label" for="User_CreateDate">@Resources.CreateDate</label>
                            <input type="text" value="@Model.User.CreateDate.ToString("dd/MM/yyyy HH:mm:ss")" class="form-control" disabled="disabled" />
                        </div>
                        <div class="form-group">
                            <label class="control-label" for="User_User_CreatedBy">@Resources.CreatedBy</label>
                            @Html.HiddenFor(m => m.User.CreatedBy)

                            @Html.FikriKibarTextBoxFor(m => m.User.User_CreatedBy.FullName, new { @class = "form-control", @placeholder = Resources.CreatedBy, @disabled = "disabled" })

                        </div>
                        <div class="form-group">
                            <label class="control-label" for="User_UpdateDate">@Resources.UpdateDate</label>

                            <input type="text" value="@Model.User.UpdateDate.ToString("dd/MM/yyyy HH:mm:ss")" class="form-control" disabled="disabled" />
                        </div>
                        <div class="form-group">
                            <label class="control-label" for="User_User_UpdatedBy">@Resources.UpdatedBy</label>
                            @Html.FikriKibarTextBoxFor(m => m.User.User_UpdatedBy.FullName, new { @class = "form-control", @placeholder = Resources.CreatedBy, @disabled = "disabled" })


                        </div>
                        <div class="form-group">
                            <div class="checkbox">
                                <label>
                                    @Html.CheckBoxFor(m => m.User.IsApproved) @Resources.Approve
                                </label>
                            </div>
                        </div>
                        @Html.FikriKibarHiddenFor(m => m.User.Id)
                        <button class="btn btn-primary"><i class="fa fa-save"></i>&nbsp;@Resources.Save</button>
                                    <a href="#" class="btn btn-danger DeleteButton" data-confirm-href="@Url.Action("Delete", "User", new {id = Model.User.Id})" data-confirm-title="@Resources.AreYouSure" data-confirm-message="@Resources.AreYouSureDelete" data-confirm-ok="@Resources.Yes" data-confirm-cancel="@Resources.No"><i class="fa fa-remove fa-fw"></i> @Resources.Delete</a>
                    }
                </div>

            </div>

            <div class="row">
                <div class="col-lg-12 text-center">
                    @Html.FikriKibarAlertFor(m => m.Message, "div", Model.Message, new { @class = "alert alert-danger" })
                </div>
            </div>
        </div>
    </div>
</div>
